/*
   Copyright (c) 2023 李伟国
   learner-platform is licensed under Mulan PSL v2.
   You can use this software according to the terms and conditions of the Mulan PSL v2. 
   You may obtain a copy of Mulan PSL v2 at:
               http://license.coscl.org.cn/MulanPSL2 
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
   See the Mulan PSL v2 for more details. 
*/

package cn.platform.controller;

import cn.platform.entity.ProblemSet;
import cn.platform.response.ResponseData;
import cn.platform.response.SuccessResponseData;
import cn.platform.service.IProblemSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "problem/set")
public class ProblemSetController extends BaseController {
    @Autowired
    private IProblemSetService problemSetService;
    // 题目集中题目列表
    @RequestMapping(value = "")
    public ResponseData getProblemList(@RequestParam(value = "setId", required = false) Long setId){
        return new SuccessResponseData(problemSetService.getProblemListBySetId(setId));
    }

    // 题目集删除题目
    public ResponseData deleteProblemBySetId(@RequestBody ProblemSet problemSet){
        return new SuccessResponseData(problemSetService.deleteProblemBySetId(problemSet));
    }

    // 题目集增加题目
    public ResponseData addProblemBySetId(@RequestBody ProblemSet problemSet){
        return new SuccessResponseData(problemSetService.addProblemBySetId(problemSet));
    }
}
